function zero = sdp_solve_mcstd(in)

global par_;

% Unpack parameters
model = par_.model;
mfreq = par_.mfreq;
estim = par_.estim;
show = par_.show;

lbar=NaN; % initialize parameters
ksi=NaN; %#ok<*NASGU> % initialize legacy code params

params_set;

switch model
        case {2}  % CALVO,  and linear hazard
                %par_.menucost = exp(in(1));  %unused;
                par_.std_eA = exp(in(1));                
        case 3  % GOLOSOV-LUCAS 
                par_.menucost =  exp(in(1)); % fixed menu cost 
                par_.std_eA = exp(in(2));
        case 4  % Woodford 
                par_.menucost =  exp(in(1)); % fixed menu cost 
                par_.std_eA = exp(in(2));
        case {5,6,7}  % linear hazard
                par_.omega =  exp(in(1)); % fixed menu cost 
                par_.std_eA = exp(in(2));
               
end

matrices_set;

opts = optimset('Display','off','TolFun',sqrt(eps),'TolX',sqrt(eps));
switch par_.estim_type
    case 'quick'
        [par_.chi,fval,flag] = fsolve('sdp_solve_chi',par_.chi,opts);
    case 'robust'
        [par_.chi,fval,flag] = fzero('sdp_solve_chi',[par_.chi0_min par_.chi0_max],opts);
end
if flag~=1
    disp('sdp_solve_chi did not converge in sdp_solve_mcstd');
end
sdp_solve_chi(par_.chi);

%    if estim
           switch model
               case {2}
                    zero(1) = log(par_.MeanAbsPchange/size_target);
               case {3,4,5,6,7}
                    zero(1) = log(par_.freqpchanges/freq_target);
                    zero(2) = log(par_.MeanAbsPchange/size_target);
           end
%    end
end